﻿package cz.dadul.adventure.model 
{
	import cz.dadul.adventure.model.Element;
	import cz.dadul.adventure.model.events.*;
	import flash.display.*;
	
	/**
	 * ...
	 * @author Dadul
	 */
	public class Item extends Element 
	{
		public static const INITIAL_STATE: String = "init";		
		// EVENTS
		public static const EVENT_REMOVE: String = "remove";
		
		protected var _sleep:Boolean;		
		// Node path
		protected var _pathVortex:*;
		
		public function Item(name:String, mc:MovieClip)
		{
			super(name, mc);
			this._sleep = false;
			this._state = Item.INITIAL_STATE;
			this._pathVortex = null;
		}
		
		/**
		 * Public methods
		 */
		public function hide():void {
			if(this.visible){
				// Remove event dispatchers
				removeEventDispatchers(_dispatcherNames);
				this.visible = false;
			}
		}
		 
		public function show():void {
			if(!this.visible){
				this.visible = true;
				// Add event dispatchers
				addEventDispatchers(_dispatcherNames);
			}			
		}
		
		/**
		 * Non-destructive remove.
		 * It dispatches an event to be removed.
		 */
		public function remove():void {
			dispatchEvent(new DataHolderEvent(EVENT_REMOVE, this));
		}
		
		public function sleep():void {
			if(!this._sleep){
				removeEventDispatchers(_dispatcherNames);
			}
		}
		
		public function wake():void {
			if(this._sleep){
				addEventDispatchers(_dispatcherNames);
			}
		}
		
		/**
		 * SETTER / GETTER
		 */
		/**
		 * TODO: Dodelat silne typovani
		 */
		public function set pathVortex(pv:*):void {
			this._pathVortex = pv;			
		}
		public function get pathVortex():* {
			return this._pathVortex;
		}
		
 
		 
	}

}